package com.zq.it.service.exam;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import com.zq.it.dao.common.PageConfig;
import com.zq.it.pojo.Teacher;
import com.zq.it.pojo.exam.TQuestionDb;
import com.zq.it.pojo.exam.TQuestions;
import com.zq.it.pojo.exam.data.ObjectData;
import com.zq.it.service.BaseService;

/**
 * Question的service接口
 *
 * @author 王凡
 *
 * @version $ID: QuestionService.java 2013-8-7 王凡@$
 */
public interface QuestionService extends BaseService {
	/**
	 * 获取所有
	 * 
	 * @param config
	 *            分页配置
	 * @return 分页数据
	 */
	public ObjectData getQuestionList(PageConfig config);

	/**
	 * 获取题库列表
	 * 
	 * @param config
	 * @return
	 */
	public ObjectData getQuestionDBList(PageConfig config);

	/**
	 * 增加试题库
	 * 
	 * @param qdb
	 */
	public void addQDB(TQuestionDb qdb);

	/**
	 * 删除试题库
	 * 
	 * @param ids
	 *            删除试题库的id
	 * @param teacher
	 *            题库创建人
	 * @return
	 */
	public String deleteQDB(String[] ids, Teacher teacher);

	/**
	 * 通过id获取试题库
	 * 
	 * @param id
	 * @return
	 */
	public TQuestionDb getQDBById(String id);

	/**
	 * 更新试题库信息
	 * 
	 * @param teacher
	 * @param qdb
	 * @throws Exception
	 */
	public void updateQDB(Teacher teacher, TQuestionDb qdb) throws Exception;

	/**
	 * 多条件查询试题库
	 * 
	 * @param qdb
	 * @return
	 */
	public String creatQDBHql(Teacher teacher, TQuestionDb qdb);

	/**
	 * 增加问题
	 * 
	 * @param question
	 * @param skey
	 * @param soption
	 * @param teacher
	 * @return
	 */
	public boolean addQuestion(TQuestions question, String skey,
			String[] soption, String qcomplex, Teacher teacher,
			HttpServletRequest request);

	/**
	 * 获取所有题库
	 * 
	 * @param teacher
	 * @return
	 */
	public List getQuestionDBList(Teacher teacher);

	/**
	 * 根据条件多条件查询试题
	 * 
	 * @param question
	 * @return
	 */
	public String creatQuestionHql(Teacher teacher, TQuestions question);

	/**
	 * 根据id获取问题
	 * 
	 * @param string
	 * @param teacher
	 * @return
	 */
	public TQuestions getQuestionById(String string, Teacher teacher);

	/**
	 * 根据问题id获取选项
	 * 
	 * @param id
	 * @return
	 */
	public String[] getOptions(long id);

	/**
	 * 删除试题
	 * 
	 * @param id
	 * @param teacher
	 * @return
	 */
	public String deleteQuestion(String[] id, Teacher teacher);

	/**
	 * 通过试题id获取选项
	 * 
	 * @param id
	 * @return
	 */
	public List getOptionsList(long id);

	/**
	 * 获取试题列表并转换内容为text
	 * 
	 * @param config
	 * @return
	 */
	public ObjectData getQuestionList2Text(PageConfig config);

}
